<!--
 * @Author: liyin 2179253556@qq.com
 * @Date: 2023-02-08 16:04:18
 * @LastEditors: liyin 2179253556@qq.com
 * @LastEditTime: 2023-03-01 17:33:32
 * @FilePath: \test\src\views\HomeView.vue
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
  <div class="index-flex-box" id="index-flex-box">
    <van-tabs v-model:active="active" sticky animated swipeable @change="tabsChanged" color="#146AF7" line-width="20px"
      line-height="4px" title-inactive-color="#999999" title-active-color="#333333">
      <van-tab title="数据统计" name="4">
        <DataTabs :active="4" ref="child4"></DataTabs>
      </van-tab>
      <van-tab title="评分管理" name="2">
        <ScoreTabs :active="2" ref="child1"></ScoreTabs>
      </van-tab>
      <van-tab title="通报管理" name="3">
        <NotifyTabs :active="3" ref="child3"></NotifyTabs>
      </van-tab>
      <van-tab title="申诉管理" name="1">
        <AppealTabs :active="1" ref="child2"></AppealTabs>
      </van-tab>
    </van-tabs>
  </div>
</template>
<script lang="ts" setup>
import { ref, reactive, onMounted, nextTick, onUnmounted } from 'vue'
import $util from '../util/util'
import { useStore } from 'vuex'
import { useRoute, useRouter } from 'vue-router'
import ScoreTabs from '../components/ScoreTabs.vue'
import NotifyTabs from '../components/NotifyTabs.vue'
import AppealTabs from '../components/AppealTabs.vue'
import DataTabs from '../components/DataTabs.vue'
const store = useStore()
const router = useRouter()
const child2 = ref<any>(null)
const child1 = ref<any>(null)
const child3 = ref<any>(null)
const child4 = ref<any>(null)
// tabs选中的标签
const active = ref<any>('4')
const tabsChanged = (val: any) => {
}
const backHome = () => {
  console.log("监听到了");
  // router.replace('/UserMessage')
}
onMounted(async () => {
  //挂载成功后给pop事件绑定一个方法
  // 如果支持 popstate （一般移动端都支持）
  // if (window.history && (window.history.pushState as any)) {
  //   history.pushState(null, null as any, document.URL)
  //   // 往历史记录里面添加一条新的当前页面的url
  //   // 给 popstate 绑定一个方法用来监听页面返回
  //   window.addEventListener('popstate', backHome, false); //false阻止默认事件
  // }
})
// onUnmounted(() => {
//   window.removeEventListener('popstate', backHome, false)
// })
</script>
<style lang="scss" scoped>
.index-flex-box {
  position: relative;
  // overflow: hidden;
}
</style>
